@extends("admin.layout.main")

@section("css")
	<link rel="stylesheet" href="/adstatic/user/user.css" media="all" />
@endsection

@section("content")
	<blockquote class="layui-elem-quote news_search">
		<div class="layui-inline">
		    <div class="layui-input-inline">
		    	<input type="text" value="{{ $querystr }}" placeholder="请输入关键字" class="layui-input search_input">
		    </div>
		    <a class="layui-btn search_btn">查询</a>
			<a href="/users" class="layui-btn">重置</a>
			<span>注：本页面支持"姓名"搜索！</span>
		</div>
		<div class="layui-inline">
			<div class="layui-form-mid layui-word-aux"></div>
		</div>
	</blockquote>
	<div class="layui-form users_list">
	  	<table class="layui-table">
		    <colgroup>
				<col width="">
				<col width="">
				<col>
				<col width="">
				<col >
				<col >
				<col width="">
				<col width="">
		    </colgroup>
		    <thead>
				<tr>
					{{--<th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose" id="allChoose"></th>--}}
					<th>用户ID</th>
					<th>姓名</th>
					<th>等级</th>
					<th>手机号</th>
					<th>推荐者</th>
					<th>状态</th>
					<th>操作</th>
					<th>创建时间</th>
					<th>更新时间</th>
				</tr>
		    </thead>
		    <tbody class="users_content">
			@foreach ($users as $user)
				<tr>
				{{--<td data-id="{{ $user->id }}"><input type="checkbox" name="checked" lay-skin="primary" lay-filter="choose"></td>--}}
				<td>{{ $user->uid }}</td>
				<td>{{ $user->name }}</td>
				<td>
					@switch($user->level)
						@case(1)
							银卡
							@break
						@case(2)
							金卡
							@break
						@case(3)
							钻卡
							@break
						@case(4)
							VIP
							@break
						@default
							未办卡
					@endswitch
				</td>
				<td>
					{{\App\Common\Tool\AxAes::decrypt($user->phone)}}
				</td>
				<td>{{ $user->getPuidName->name }}</td>
				<td>
					@if($user->status==1)
						正常
					@else
						禁用
					@endif
				</td>
				<td>
					<a data-id="{{ $user->id }}" class="layui-btn layui-btn-normal layui-btn-mini edit_user">
						<i class="layui-icon">&#xe642;</i>
						重置密码
					</a>
					<button data-id="{{ $user->id }}" data-uid="{{$user->uid}}" class="layui-btn layui-btn-danger layui-btn-mini delete_user">
						<i class="layui-icon">&#xe640;</i>
						删除
					</button>
				</td>
				<td>{{ date('Y-m-d H:i:s',$user->create_time) }}</td>
				<td>{{ $user->update_time?date('Y-m-d H:i:s',$user->update_time):'暂无' }}</td>
				</tr>
			@endforeach
			</tbody>
		</table>
	</div>
	<div style="text-align: right;">
	{{ $users->appends(['querystr'=>$querystr])->links('admin.layout.paginate') }}
	</div>

@endsection

@section("js")
	<script type="text/javascript" src="/adstatic/user/users.js"></script>
@endsection
